/*!
 * Ext JS Library 3.2.0
 * Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com
 * http://www.extjs.com/license
 */

Ext.onReady(function() {
	
	var button = Ext.get('show-btn');

    button.on('click', function(){
    	var map = Ext.getCmp('mapPanel');
    	alert(map.getCenter());
    	map.addMarkers([ {lat : 41.8874,lng : 12.4902,marker : {title : 'Boston Museum of Fine Arts'},listeners : {click : function(e) {Ext.Msg.alert('Its fine', 'and its art.');}}}, {lat :43.811,lng : 11.1716,marker : {title : 'Northeastern University'}} ]);
    });

	var mapPanel = new Ext.Panel({
		layout : 'fit',
		title : 'GMap Window',
		closeAction : 'hide',
		renderTo: 'header',
		width : 800,
		autoWidth:true,
		height : 400,
		items : {
			id : 'mapPanel',
			xtype : 'gmappanel',
			zoomLevel : 6,
			gmapType : 'map',
			mapConfOpts : [ 'enableScrollWheelZoom', 'enableDoubleClickZoom',
					'enableDragging' ],
			mapControls : [ 'GSmallMapControl', 'GMapTypeControl',
					'NonExistantControl' ],
			setCenter : {
				//geoCodeAddr : 'Viale Vaticano, 00165 Vatican City',
				lat : 41.865,
				lng : 12.6012,
				marker : {
					title : 'Fenway Park'
				}
			},
			markers : [ {
				lat : 42.339641,
				lng : -71.094224,
				marker : {
					title : 'Boston Museum of Fine Arts'
				},
				listeners : {
					click : function(e) {
						Ext.Msg.alert('Its fine', 'and its art.');
					}
				}
			}, {
				lat : 42.339419,
				lng : -71.09077,
				marker : {
					title : 'Northeastern University'
				}
			} ]
		}
	});

});